package com.room.search.repository;

import com.room.search.domain.CityList;
import com.room.search.service.dto.city.SearchCityListDTO;
import com.tencentcloudapi.ecm.v20190719.models.City;
import org.springframework.data.jpa.repository.*;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Spring Data SQL repository for the CityList entity.
 */
@SuppressWarnings("unused")
@Repository
public interface CityListRepository extends JpaRepository<CityList, Long> {
    @Query("select distinct new com.room.search.service.dto.city.SearchCityListDTO(cl.id,cl.countryName,cl.adm1Name,cl.adm2Name,cl.adm1NameEN,cl.cityInitial,cl.lng,cl.lat) from CityList cl")
    List<SearchCityListDTO> findAllDistinctByAdm1NameEn();

    List<SearchCityListDTO> findAllByAdm1Name(String province);

    CityList findByAdm1NameAndAdm2Name(String admName, String adm2Name);
}
